<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>

<script>
import Chart from './chart.vue'
export default {
  components: {
    Chart
  },
  data() {
    return {
      cdata: {
        category: [
          '11-02',
          '11-03',
          '11-04',
          '11-05',
          '11-06',
          '11-07',
          '11-08',
          '11-09',
          '11-10',
          '11-11',
          '11-12',
          '11-13',
          '11-14',
          '11-15',
          '11-16'
        ],
        allData: [
          91.4,
          87.8,
          91.4,
          91.4,
          91.4,
          91.4,
          88.8,
          91.4,
          93,
          88.8,
          91.4,
          92.2,
          91.4,
          95,
          91.4
        ],
        perfectData: [
          90.4,
          89,
          90.4,
          90.9,
          90.4,
          90.4,
          88.5,
          90.4,
          92.3,
          88.5,
          90.4,
          92.2,
          91.7,
          94.4,
          90.4
        ],
        rateData: [
          12609,
          11979,
          12651,
          12543,
          12731,
          12622,
          12179,
          12644,
          12939,
          12179,
          12628,
          12696,
          12609,
          13249,
          12612
        ],
        roseData: [
          {
            value: 10,
            name: 'rose1'
          },
          {
            value: 5,
            name: 'rose2'
          },
          {
            value: 15,
            name: 'rose3'
          },
          {
            value: 25,
            name: 'rose4'
          },
          {
            value: 20,
            name: 'rose5'
          },
          {
            value: 35,
            name: 'rose6'
          },
          {
            value: 30,
            name: 'rose7'
          },
          {
            value: 40,
            name: 'rose8'
          }
        ]
      }
    }
  },
  mounted() {
    this.setData()
  },
  methods: {
    // 根据自己的业务情况修改
    setData() {
      for (let i = 0; i < this.cdata.perfectData.length - 1; i++) {
        // let rate = this.cdata.perfectData[i] / this.cdata.allData[i];
        // this.cdata.rateData.push(rate.toFixed(2));
        this.cdata.perfectData[i].toFixed(1)
        this.cdata.allData[i].toFixed(1)
      }
      // console.log(this.cdata);
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
